package com.ble.base;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;


/**
 * Created by Ken on 2016/3/7.
 */
public abstract class BaseFragment extends Fragment {


    protected abstract int getContentResid();

    protected Activity self;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(getContentResid(), container, false);

        self = getActivity();
        return view;
    }

    /**
     * 该方法会紧跟着onCreateView被调用
     *
     * @param view
     * @param savedInstanceState
     */
    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        init(view);
        loadDatas();
        init2(view);
    }


    /**
     * 初始化方法
     *
     * @param view
     */
    protected void init(View view) {

    }
    /**
     * 初始化方法
     *
     * @param view
     */
    protected void init2(View view) {

    }

    /**
     * 加载数据的方法
     */
    protected void loadDatas() {
    }

}
